package com.authentication.convertor;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationConverter;

import javax.servlet.http.HttpServletRequest;

public class LoginAuthenticationConvertor implements AuthenticationConverter {
    @Override
    public Authentication convert(HttpServletRequest request) {
        return new UsernamePasswordAuthenticationToken(
                request.getParameter("userName"),
                request.getParameter("password")
        );
    }
}
